/*
  ODBuzzer.cpp - 
*/

#include "ODBuzzer.h"
#include "ODPort.h"
#include "WProgram.h"

Buzzer::Buzzer() {
  return;
}

void Buzzer::init(uint8_t pin) {
  _port.initOutput(pin, LOW);
  _stopTime = 0;
}

void Buzzer::beep(uint16_t ms) {
  _port.setStatus(HIGH);
  _stopTime = millis() + ms;
}

void Buzzer::service() {
  if (millis() > _stopTime)
    _port.setStatus(LOW);
}